<?php
include("../connection.php");
include("heder1.php");
//echo  $ceraterid=$_SESSION['userid'];

?>
<link rel="stylesheet" type="text/css" media="all" href="jsDatePick_ltr.min.css" />
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
	window.onload = function(){
		new JsDatePick({
			useMode:2,
			target:"inputField",
			dateFormat:"%Y-%m-%d"
			
		});
	};
</script>
<?php


if($_GET["action"]=="save")
{
	  $eventname=$_POST["eventname"];
	  $venue=$_POST["venue"];
	  $date=$_POST["date"];
	  $starttime=$_POST["starttime"];
	  $endtime=$_POST["endtime"];
	  $maixumnumber=$_POST["maxnum"];
	  $guest=$_POST["guest"];
	  $des=$_POST["des"];
	  $payment=$_POST["payment"];
	  $type=$_POST["type"];
      $ceraterid=$_SESSION['userid'];
	$time1=$_POST['time1'];
	$time2=$_POST['time2'];
	$time3=$_POST['time3'];
	$time4=$_POST['time4'];
	$time5=$_POST['time5'];
	$time6=$_POST['time6'];
	$time7=$_POST['time7'];
	$time8=$_POST['time8'];
	$time9=$_POST['time9'];
	$time10=$_POST['time10'];
	
	$program1=$_POST['program1'];
	$program2=$_POST['program2'];
	$program3=$_POST['program3'];
	$program4=$_POST['program4'];
	$program5=$_POST['program5'];
	$program6=$_POST['program6'];
	$program7=$_POST['program7'];
	$program8=$_POST['program8'];
	$program9=$_POST['program9'];
	$program10=$_POST['program10'];
	
	
	$q=mysql_query("SELECT * FROM event WHERE eventname='".$eventname."'")or die(			    mysql_error());
		if(mysql_num_rows($q)<1)
		{
			if($venue=="" || $date=="" || $starttime=="" || $endtime=="")
			{
			echo"fill the text field";
			}
		
			else{
			 mysql_query("INSERT INTO 			     event(eventname,venue,date,starttime,endtime,maxnum,guest,des,payment,type,ceraterid,time1,time2,time3,time4,time5,time6,time7,time8,time9,time10,program1,program2,program3,program4,program5,program6,program7,program8,program9,program10)VALUES('$eventname','$venue','$date','$starttime','$endtime','$maixumnumber','$guest','$des','payment','$type','$ceraterid','$time1','$time2','$time3','$time4','$time5','$time6','$time7','$time8','$time9','$time10','$program1','$program2','$program3','$program4','$program5','$program6','$program7','$program8','$program9','$program10')")or
die(mysql_error());

echo"your event created";

			} 
		}
		else 
		{

		echo "already this event was created another person.plz create another name";
		}

}


?>






<form name="form1" method="post" action="createevent.php?action=save">
<table width="299" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFD8B0">
  <tr>
    <td colspan="2"><div align="center"><h2>CREATE THE EVENT</h2> </div></td>
  </tr>
  <tr>
    <td width="150"><h4>Event name</h4> </td>
    <td width="143">
      <label></label>
   
     <input type="text" name="eventname"></td>
  </tr>
  <tr>
    <td><h4>Vanue</h4></td>
    <td><label>
      <input type="text" name="venue">
    </label></td>
  </tr>
  <tr>
    <td><h4>Date</h4></td>
    <td><input type="text" name="date" id="inputField"></td>
  </tr>
  <tr>
    <td><h4>Steart time</h4></td>
    <td><input type="text" name="starttime"></td>
  </tr>
  <tr>
    <td><h4>End time</h4> </td>
    <td><label>
      <input type="text" name="endtime">
    </label></td>
  </tr>
  <tr>
    <td><h4>Maximum number</h4></td>
    <td><input type="text" name="maximumnumber"></td>
  </tr>
  <tr>
    <td><h4>Guest</h4></td>
    <td><input type="text" name="guest"></td>
  </tr>
  <tr>
    <td><h4>Discribution</h4></td>
    <td><input type="text" name="des"></td>
  </tr>
  <tr>
    <td><h4>Payment</h4></td>
    <td><input type="text" name="payment"></td>
  </tr>
   <tr>
    <td><h4>Event type</h4></td>
    <td>
	<select name="type">
	<?php
	$result=mysql_query("SELECT * FROM eventtype");
	while($row=mysql_fetch_array($result))
	{
	echo"<option value='".$row['title']."'>".$row['title']."</option>";
	}
	?>
	</select>	</td>
  </tr>
  
  <tr>
    <td colspan="2"><h4 align="center">Create the aganda</h4> </td>
    </tr>
 <tr>
    <td><h4>Time interval</h4></td>
    <td><h4>Program list</h4></td>
  </tr>
  <tr>
    <td><input type="text" name="time1"></td>
    <td><input type="text" name="program1"></td>
  </tr>
   <tr>
    <td><input type="text" name="time2"></td>
    <td><input type="text" name="program2"></td>
  </tr>
  <tr>
    <td><input type="text" name="time3"></td>
    <td><input type="text" name="program3"></td>
  </tr>
  <tr>
    <td><input type="text" name="time4"></td>
    <td><input type="text" name="program4"></td>
  </tr>
  <tr>
    <td><input type="text" name="time5"></td>
    <td><input type="text" name="program5"></td>
  </tr>
  <tr>
    <td><input type="text" name="time6"></td>
    <td><input type="text" name="program6"></td>
  </tr>
  <tr>
    <td><input type="text" name="time7"></td>
    <td><input type="text" name="program7"></td>
  </tr>
  <tr>
    <td><input type="text" name="time8"></td>
    <td><input type="text" name="program8"></td>
  </tr>
  <tr>
    <td><input type="text" name="time9"></td>
    <td><input type="text" name="program9"></td>
  </tr>
  <tr>
    <td><input type="text" name="time10"></td>
    <td><input type="text" name="program10"></td>
  </tr>
  <tr>
    <td colspan="2"><label>
      <div align="center">
          <input type="submit" name="Submit" value="create">
        </div>
      </label></td></tr>
	<tr>
    <td height="79" colspan="2"><label>
      </label></td>
	</tr>
</table>
</form>
<?php
include("../footer.php");
?>